﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.Json.Serialization;
using System.Threading.Tasks;

namespace Simple.Repository.Models
{
    public class DynamicLike : BusinessFullEntityBase<Guid>
    {
        /// <summary>
        /// 动态id
        /// </summary>
        public Guid ClassDynamicId { get; set; }

        /// <summary>
        /// 家属id/老师id
        /// </summary>
        public Guid ParentOrTeacherId { get; set; }

        /// <summary>
        /// 登录类型
        /// </summary>
        [JsonConverter(typeof(JsonStringEnumConverter))]
        public LoginType? LoginType { get; set; }

        /// <summary>
        /// 点赞人
        /// </summary>
        public string? LikeParentName { get; set; }

        /// <summary>
        /// 关系
        /// </summary>
        public string? Relationship { get; set; }

        /// <summary>
        /// 点赞时间
        /// </summary>
        public DateTime? LikeDate { get; set; }

        public ClassDynamic? ClassDynamic { get; set; }

        public override void ConfigureEntity(ModelBuilder builder)
        {

            builder.Entity<DynamicLike>(entity =>
            {
                entity.ToTable("Class_DynamicLike");
                entity.HasOne(c => c.ClassDynamic).WithMany(c => c.DynamicLikes).HasForeignKey(c => c.ClassDynamicId);
            });
        }
    }
}
